From: Keir Fraser Date: Mon, 21 Apr 2008 13:59:25 +0000 (+0100) Subject: AMD IOV: Fix xen boot on non-iommu systems. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~14215^2~156 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22?a=commitdiff_plain;h=ff7d5444579491e1f94752afa7d56fa5a6a090ef;p=xen.git AMD IOV: Fix xen boot on non-iommu systems. Signed-off-by: Wei Wang --- diff --git a/xen/drivers/passthrough/amd/iommu_detect.c b/xen/drivers/passthrough/amd/iommu_detect.c index 68d04a66a2..d3b51b9830 100644 --- a/xen/drivers/passthrough/amd/iommu_detect.c +++ b/xen/drivers/passthrough/amd/iommu_detect.c @@ -216,24 +216,24 @@ static int __init scan_functions_for_iommu( int bus, int dev, iommu_detect_callback_ptr_t iommu_detect_callback) { int func, hdr_type; - int count, error = 0; + int count = 1, error = 0; + + for ( func = 0; + (func < count) && !error && + VALID_PCI_VENDOR_ID(pci_conf_read16(bus, dev, func, + PCI_VENDOR_ID)); + func++ ) - func = 0; - count = 1; - while ( VALID_PCI_VENDOR_ID(pci_conf_read16(bus, dev, func, - PCI_VENDOR_ID)) && - !error && (func < count) ) { hdr_type = pci_conf_read8(bus, dev, func, PCI_HEADER_TYPE); - if ( func == 0 && IS_PCI_MULTI_FUNCTION(hdr_type) ) + if ( (func == 0) && IS_PCI_MULTI_FUNCTION(hdr_type) ) count = PCI_MAX_FUNC_COUNT; if ( IS_PCI_TYPE0_HEADER(hdr_type) || IS_PCI_TYPE1_HEADER(hdr_type) ) error = scan_caps_for_iommu(bus, dev, func, iommu_detect_callback); - func++; } return error;